<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<?php
    require_once "../funciones.php";
    $con = con_intranetpccom();
    $id = $_REQUEST['rq'];

    //Se pone en contexto la informacion de la inconcistencia
    $sql = "select * from equiposinconsistentes where id = $id";
    $result = mysql_query($sql);
    $inco = mysql_fetch_array($result);

    //se pone en contexto informacion de sucursal
    $sql = "select sucursalfactura,facturable,estado from basefacturacion where id = {$inco['idfacturacion']}";
    $result = mysql_query($sql);
    $base = mysql_fetch_array($result);

    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <script src="../js/jquery.js" type="text/javascript"></script>
        <script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
    </head>
    <script type="text/javascript">
            function enviar(){
                    if(!isNaN($("#valor").val()) || !($("#valor").length > 0)){
                        $.post("admconsErrores.php?opc=3&id=<?php echo $id; ?>", $("#internos").serialize(), function(infor){
                            alert("Actualizacion Exitosa");
                            $("#cancelar").trigger('click');
                        });
                    }else alert("Ingrese solo valores numericos");
                return;
        }

    </script>
    <body>
        <form  method="POST" name="internos" id="internos">
        <table border="1">
            <caption><h3>INTERNO <?php echo $inco['interno']; ?></h3></caption>
            <tr>
                <td><label for="est">Estado</label></td>
                <td>
                    <?php
                        if($base['estado'] == 'V')
                            echo "<input type='text' name='est' value='V' readonly>";
                        else{
                    ?>
                    <select name="est" id="est">
                        <?php
                            echo "<option value={$base['estado']}>{$base['estado']}</option>";
                            ?>
                        <option value="V">Vigente</option>
                    </select>
                    <?php
                        }
                    ?>
                </td>
            </tr>
            <tr>
                <td><label for="sucursal">Sucursal Factura</label></td>
                <td>
                    <select name="sucursal" id="sucursal">
                        <?php
                        $sql = "select codigosucursal from sucursales order by codigosucursal";
                        $result = mysql_query($sql);
                        if($base['sucursalfactura'] == "")
                        echo "<option value='' selected></option>";
                        while($suc = mysql_fetch_array($result)){
                            if($suc['codigosucursal'] == $base['sucursalfactura'])
                                $aux = "selected";
                            echo "<option value='".$suc['codigosucursal']."' $aux>{$suc['codigosucursal']}</option>";
                            $aux = "";
                        }
                        ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td><label for="fact">Facturable</label></td>
                <td> <input type="checkbox" name="fact" id="fact" <?php if($base['facturable'] == 'Si') echo "checked" ?> /> </td>
            </tr>
            <?php
            $temp = strpos($inco['descripcion'], "No tiene valor alquiler");
            if($temp >= 0){
                //if(strpos($inco['descripcion'], "No tiene valor alquiler") >= 0){
            ?>
            <tr>
                <td><label for="valor">Valor Alquiler</label></td>
                <td> <input type="text" name="valor" id="valor" /> </td>
            </tr>
            <?php
                //}
            }
            ?>
            <tr>
                <td colspan="2">
                    <input type="button" value="Actualizar" style="font-size: 14; font-style: italic; " onclick="return enviar();" />
                    <input type="button" value="Cerrar" id="cancelar" onclick="tb_remove();" />
                </td>
            </tr>
        </table>
            </form>
    </body>
</html>
